<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head>
	<title>云儿，结婚两周快乐</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<style type="text/css">
		@font-face {
			font-family: digit;
			src: url('digital-7_mono.ttf') format("truetype");
		}
	</style>
	<link rel="icon" href="http://foryun.com.cn/1Image/foryun.jpg" type="image/x-icon"/>
	<link href="css/default.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/garden.js"></script>
    <script type="text/javascript" src="js/functions.js"></script>
	<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
</head>

<body>
	<audio id="bgsound" loop="loop" autoplay="autoplay" preload="auto">
		<source src="bg.mp3">
	</audio>
	<div id="mainDiv">
		<div id="content">
			<div id="loveHeart">
				<canvas id="garden"></canvas>
				<div id="words">
					<div id="messages">
						云儿，结婚两周年快乐。往后余生,风雪是你，平淡是你；清贫是你，荣华是你；心底温柔是你，目光所至也是你。我们已经结婚了
						<div id="elapseClock"></div>
					</div>
					<div id="loveu">
						爱你一辈子哟。<br/>
						<div class="signature">- 锦</div>
					</div>
				</div>
			</div>
		</div>
		<div id="copyright">
			Copyright © 2020 <a href='http://foryun.com.cn'>Foryun</a>
		</div>
	</div>
	<script type="text/javascript">
		var offsetX = $("#loveHeart").width() / 2;
		var offsetY = $("#loveHeart").height() / 2 - 55;
		var together = new Date();
		//year	必需。表示年份的四位整数。用本地时间表示。
		//month	可选。表示月份的数值，介于 0 ~ 11 之间。用本地时间表示。
		//day	可选。表示月中某一天的数值，介于 1 ~ 31 之间。用本地时间表示。
		together.setFullYear(2018, 0, 1);
		together.setHours(0);
		together.setMinutes(0);
		together.setSeconds(0);
		together.setMilliseconds(0);

		if (!document.createElement('canvas').getContext) {
			var msg = document.createElement("div");
			msg.id = "errorMsg";
			msg.innerHTML = "Your browser doesn't support HTML5!<br/>Recommend use Chrome 14+/IE 9+/Firefox 7+/Safari 4+";
			document.body.appendChild(msg);
			$("#copyright").css("position", "absolute");
			$("#copyright").css("bottom", "10px");
		    document.execCommand("stop");
		} else {
			setTimeout(function () {
				startHeartAnimation();
			}, 500);

			timeElapse(together);
			setInterval(function () {
				timeElapse(together);
			}, 500);

			adjustCodePosition();
		}

		var audio = document.getElementById("bgsound");
		audio.preload = 'auto';
		autoPlayMusic(audio);

		// 音乐播放
		function autoPlayMusic(audio) {
			// 自动播放音乐效果，解决浏览器或者APP自动播放问题
			function musicInBrowserHandler() {
				audio.play();
				document.body.removeEventListener('touchstart', musicInBrowserHandler);
			}

			document.body.addEventListener('touchstart', musicInBrowserHandler);

			// 自动播放音乐效果，解决微信自动播放问题
			function musicInWeixinHandler() {
				audio.play();
				document.addEventListener("WeixinJSBridgeReady", function () {
					audio.play();
				}, false);

				document.removeEventListener('DOMContentLoaded', musicInWeixinHandler);
			}
			document.addEventListener('DOMContentLoaded', musicInWeixinHandler);
		}
	</script>
</body>
</html>
